<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            padding-bottom: 800px;
            padding-left: 30px;
        }
        li{
            margin-bottom: 15px;
        }
        li input{
            margin-left: 20px;
        }
    </style>
</head>

<body>
    <div id="app">
        <h4>v-memo性能比对指令(vue3^)</h4>
        <ol>
            <li v-for="u in users" :key="u.No" v-memo=" [u.name,u.sex] ">
                <div>
                    姓名：{{ u.name }}
                    <input type="text" :value="u.name" @input=" u.name=$event.target.value ">
                </div>
                <div>
                    性别：{{ u.sex }}
                    <input type="text" :value="u.sex" @input=" u.sex=$event.target.value ">
                </div>
                <div>
                    电话：{{ u.tel }}
                    <input type="text" :value="u.tel" @input=" u.tel=$event.target.value ">
                </div>
            </li>
        </ol>
    </div>
    <script src="../assets/mock/mock-min.js"></script>
    <script type="module">
        // 加载 Vue3 的ESM 模块文件
        import { createApp } from "../assets/vue3/vue.esm-browser.js"
        createApp({
            data() {
                return {
                    users: Mock.mock({
                        "users|6": [
                            {
                                No: "@id",
                                name: "@cname",
                                "sex|1": ["男", "女", "未知"],
                                tel: /^1\d{10}$/
                            }
                        ]
                    }).users
                }
            }
        }).mount("#app")
    </script>
</body>

</html>